package com.eatrip.service.implementation;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eatrip.bean.Commento;
import com.eatrip.dao.CommentiDAO;
import com.eatrip.service.CommentiService;

@Service
public class CommentiServiceImple implements CommentiService {

	//inserire autowired dao
	@Autowired
	private CommentiDAO commentiDAO;
	
	@Override
	@Transactional(readOnly=true)
	public Commento getCommento(int idCommento) {
		return commentiDAO.getCommento(idCommento);
	}

	@Override
	@Transactional(readOnly=true)
	public List<Commento> getAllCommenti() {
		return commentiDAO.getAllCommenti();
	}

	@Override
	@Transactional(readOnly=false)
	public void insertCommento(Commento commento) {
		commentiDAO.insertCommento(commento);
	}

	@Override
	@Transactional(readOnly=false)
	public void updateCommento(Commento commento) {
		commentiDAO.updateCommento(commento);
	}

	@Override
	@Transactional(readOnly=false)
	public void deleteCommento(Commento commento) {
		commentiDAO.deleteCommento(commento);
	}

	@Override
	@Transactional(readOnly=false)
	public void deleteAllCommenti() {
		commentiDAO.deleteAllCommenti();
	}

}
